From 3e0ca415e29e3f1f369c9ee405074867f0eb5bdc Mon Sep 17 00:00:00 2001 From: Debian X Strike Force Date: Mon, 10 Jun 2024 19:59:35 +0300 Subject: [PATCH] path_max Gbp-Pq: Name path_max.diff --- src/gallium/auxiliary/pipe-loader/pipe_loader.c | 4 ++++ src/util/tests/cache_test.cpp | 4 ++-- src/util/tests/process_test.c | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c index 8ffb416b3..38dda610b 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c @@ -42,6 +42,10 @@ #define PATH_MAX _MAX_PATH #endif +#if !defined(PATH_MAX) && defined(__GNU__) +#define PATH_MAX (4096) +#endif + #define MODULE_PREFIX "pipe_" static int (*backends[])(struct pipe_loader_device **, int) = { diff --git a/src/util/tests/cache_test.cpp b/src/util/tests/cache_test.cpp index 48d723b47..ce4fc0762 100644 --- a/src/util/tests/cache_test.cpp +++ b/src/util/tests/cache_test.cpp @@ -83,8 +83,8 @@ check_directories_created(void *mem_ctx, const char *cache_dir) { bool sub_dirs_created = false; - char buf[PATH_MAX]; - if (getcwd(buf, PATH_MAX)) { + char *buf = getcwd(NULL, 0); + if (buf) { char *full_path = ralloc_asprintf(mem_ctx, "%s%s", buf, ++cache_dir); struct stat sb; if (stat(full_path, &sb) != -1 && S_ISDIR(sb.st_mode)) diff --git a/src/util/tests/process_test.c b/src/util/tests/process_test.c index dd4e7bf8c..0e937e2c1 100644 --- a/src/util/tests/process_test.c +++ b/src/util/tests/process_test.c @@ -36,6 +36,10 @@ #define PATH_MAX MAX_PATH #endif +#if !defined(PATH_MAX) && defined(__GNU__) +#define PATH_MAX (4096) +#endif + static bool error = false; static void -- 2.30.2